/*

 @name    : 锅巴汉化 - Web汉化插件
 @author  : 麦子、JAR、小蓝、好阳光的小锅巴
 @version : V0.6.1 - 2019-07-09
 @website : http://www.g8hh.com
 @idle games : http://www.gityx.com
 @QQ Group : 627141737

*/

//1.汉化杂项
var cnItems = {
    _OTHER_: [],

    //未分类：
    'Save': '保存',
    'Export': '导出',
    'Import': '导入',
    'Settings': '设置',
    'Achievements': '成就',
    'Statistics': '统计',
    'Changelog': '更新日志',
    'Hotkeys': '快捷键',
    'ALL': '全部',
    'Default': '默认',
    'AUTO': '自动',
    'default': '默认',
    "points": "点数",
    "Reset for +": "重置得到 + ",
    "Currently": "当前",
    "Effect": "效果",
    "Cost": "成本",
    "Goal:": "目标:",
    "Reward": "奖励",
    "Start": "开始",
    "Exit Early": "提前退出",
    "Finish": "完成",
    "Milestone Gotten!": "获得里程碑！",
    "Milestones": "里程碑",
    "Completed": "已完成",
    "Achievement Gotten!": "成就达成！",
    "Irwing": "欧文",
    "Pen": "钢笔",
    "Options": "选项",
    "Pencil": "铅笔",
    "Printer": "打印机",
    "Mango H": "芒果 H",
    "Keyboard": "键盘",
    "Welcome to The Machine": "欢迎来到机器",
    "Sand H": "沙子 H",
    "Multidimensional H": "多维度 H",
    "Lead Poisoning": "铅中毒",
    "Kamilia's H": "卡米利亚的 H",
    "Glod Shop": "黄金商店",
    "Open H Business": "打开 H 商业",
    "Open The Machine": "打开机器",
    "RESET": "重置",
    "Save Game": "保存游戏",
    "Yes": "是",
    "Are you sure?": "你确定吗？",
    "Change themes": "切换主题",
    "Click the H": "点击 H",
    "Close Menu": "关闭菜单",
    "Automation": "自动化",
    "Buy Max": "购买最大",
    "Unlock Automation": "解锁自动化",
    "Unlock Broken Keyboard Auto": "解锁损坏的键盘自动",
    "Unlock Dragon Employee Auto": "解锁龙员工自动",
    "Unlock Employee Auto": "解锁员工自动",
    "Unlock Genetically Modified H Men Auto": "解锁转基因 H Men Auto",
    "Unlock Google drive link Auto": "解锁谷歌驱动链接自动",
    "Unlock H Colonization Auto": "解锁 H 殖民自动",
    "Unlock H File Tactics Auto": "解锁 H 文件策略自动",
    "Unlock H Secret Cult Auto": "解锁 H 秘密崇拜自动",
    "Unlock Intern Auto": "解锁实习生自动",
    "Unlock Keyboard Auto": "解锁键盘自动",
    "Unlock Pen Auto": "解锁笔自动",
    "Unlock Pencil Auto": "解锁铅笔自动",
    "Unlock Prestige Auto": "解锁威望自动",
    "Unlock Printer Auto": "解锁打印机自动",
    "Unlock Psychological Warfare Auto": "解锁心理战自动",
    "Unlock Random Auto": "解锁随机自动",
    "Unlock Shady Business Partner Auto": "解锁黑幕商业伙伴自动",
    "Unlock Typewriter Auto": "解锁打字机自动",
    "Unspent Glod H Nuggets boost Glod H boost": "未使用的 Glod H 掘金提振 Glod H 提振",
    "Upgrades": "升级",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    // 图标代码，不能汉化
    "Jacorb's Games": "Jacorb's Games",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "By Jacorb90": "By Jacorb90",
    "content_copy": "content_copy",
    "library_books": "library_books",
    "discord": "discord",
    "drag_handle": "drag_handle",
    "edit": "edit",
    "forum": "forum",
    "content_paste": "content_paste",
    "delete": "delete",
    "info": "info",
    "settings": "settings",

    //树游戏
    'Loading...': '加载中...',
    'ALWAYS': '一直',
    'HARD RESET': '硬重置',
    'Export to clipboard': '导出到剪切板',
    'INCOMPLETE': '不完整',
    'HIDDEN': '隐藏',
    'AUTOMATION': '自动',
    'NEVER': '从不',
    'ON': '打开',
    'OFF': '关闭',
    'SHOWN': '显示',
    'Play Again': '再次游戏',
    'Keep Going': '继续',
    'The Modding Tree Discord': '模型树Discord',
    'You have': '你有',
    'It took you {{formatTime(player.timePlayed)}} to beat the game.': '花费了 {{formatTime(player.timePlayed)}} 时间去通关游戏.',
    'Congratulations! You have reached the end and beaten this game, but for now...': '恭喜你！ 您已经结束并通关了本游戏，但就目前而言...',
    'Main Prestige Tree server': '主声望树服务器',
    'Reach {{formatWhole(ENDGAME)}} to beat the game!': '达到 {{formatWhole(ENDGAME)}} 去通关游戏!',
    "Loading... (If this takes too long it means there was a serious error!": "正在加载...（如果这花费的时间太长，则表示存在严重错误！",
    'Loading... (If this takes too long it means there was a serious error!)←': '正在加载...（如果时间太长，则表示存在严重错误！）←',
    'Main\n\t\t\t\tPrestige Tree server': '主\n\t\t\t\t声望树服务器',
    'The Modding Tree\n\t\t\t\t\t\t\tDiscord': '模型树\n\t\t\t\t\t\t\tDiscord',
    'Please check the Discord to see if there are new content updates!': '请检查 Discord 以查看是否有新的内容更新！',
    'aqua': '水色',
    'AUTOMATION, INCOMPLETE': '自动化，不完整',
    'LAST, AUTO, INCOMPLETE': '最后，自动，不完整',
    'NONE': '无',
    'P: Reset for': 'P: 重置获得',
    'Git游戏': 'Git游戏',
    'QQ群号': 'QQ群号',
    'x': 'x',
    'QQ群号:': 'QQ群号:',
    '* 启用后台游戏': '* 启用后台游戏',
    '更多同类游戏:': '更多同类游戏:',
    '': '',
    '': '',
    '': '',

}


//需处理的前缀
var cnPrefix = {
    "\n": "",
    "                   ": "",
    "                  ": "",
    "                 ": "",
    "                ": "",
    "               ": "",
    "              ": "",
    "             ": "",
    "            ": "",
    "           ": "",
    "          ": "",
    "         ": "",
    "        ": "",
    "       ": "",
    "      ": "",
    "     ": "",
    "    ": "",
    "   ": "",
    "  ": "",
    " ": "",
    //树游戏
    "\t\t\t": "\t\t\t",
    "\n\n\t\t": "\n\n\t\t",
    "\n\t\t": "\n\t\t",
    "\t": "\t",
    "Show Milestones: ": "显示里程碑：",
    "Autosave: ": "自动保存: ",
    "Offline Prod: ": "离线生产: ",
    "Completed Challenges: ": "完成的挑战: ",
    "High-Quality Tree: ": "高质量树贴图: ",
    "Offline Time: ": "离线时间: ",
    "Theme: ": "主题: ",
    "Anti-Epilepsy Mode: ": "抗癫痫模式：",
    "In-line Exponent: ": "直列指数：",
    "Single-Tab Mode: ": "单标签模式：",
    "Time Played: ": "已玩时长：",
    "Shift-Click to Toggle Tooltips: ": "Shift-单击以切换工具提示：",
    "Increase glod limit by ": "将黄金上限提高 ",
    "Intern (": "实习生 (",
    "H Business": "H 商业",
    "H Colonization (": "H 殖民 (",
    "H File Tactics (": "H 档案战术 (",
    "H Secret Cult (": "H 秘教 (",
    "Hard Mode": "困难模式",
    "Hatsune Miku Colour Palette": "初音未来调色板",
    "Here you can sacrifice all your wealth for the Glod H, you will lose all your progress, but the Glod H will help you rebuild your empire quicker than before.": "在这里你可以为 黄金 H 牺牲你所有的财富，你会失去所有的进步，但 黄金 H 会帮助你比以前更快地重建你的帝国。",
    "Hilarious H (": "搞笑H（",
    "Increase glod limit by 10": "将黄金上限提高 10",
    "Increase glod limit by 30": "将黄金上限提高 30",
    "Intern (": "实习生 (",
    "Irwing (": "欧文 (",
    "Kamilia's H (": "卡米利亚的 H (",
    "Keyboard (": "键盘 （",
    "Lead Poisoning (": "铅中毒 （",
    "Light Blue": "浅蓝",
    "Mango H (": "芒果H (",
    "Multidimensional H (": "多维 H (",
    "Novalis by GrilleX (": "格栅X 的 诺瓦利斯 (",
    "Orangey": "奥兰奇",
    "Papyrus Undertale": "纸莎草 传说之下",
    "Pastel": "粉彩",
    "Pen (": "笔 （",
    "Pencil (": "铅笔 （",
    "Printer (": "打印机 (",
    "Psychological Warfare (": "心理战（",
    "Purple": "紫色的",
    "Random (": "随机 （",
    "Reddish": "微红",
    "Sand H (": "沙 H (",
    "Shady Business Partner (": "阴暗的商业伙伴（",
    "Somebody Scream": "有人尖叫",
    "Strawberry H (": "草莓 H (",
    "Subservient Fish (blood for the blood god) (": "臣属鱼（血神之血）（",
    "The Machine": "机器",
    "Time Machine H (": "时光机 H (",
    "Typewriter (": "打字机（",
    "Volcanic asH (": "火山灰 （",
    "Golf Ball h (": "高尔夫球 h (",
    "Green": "绿色",
    "Genetically Modified H Men (": "转基因 H 人 (",
    "Blue": "蓝色",
    "Broken Keyboard (": "键盘坏了（",
    "Cheese Pyramid": "奶酪金字塔",
    "Chocolate H (": "巧克力 H (",
    "Crime H (": "犯罪 H (",
    "Dark": "黑色",
    "Dragon Employee (": "龙员工 (",
    "Dragon H (": "龙H (",
    "Employee (": "员工 （",
    "Eye Bleeding Mode": "眼睛出血模式",
    "Fate": "命运",
    "Funny H (": "有趣的 H (",
    "Gain +1 H/c at the start of the game": "游戏开始时获得+1 H/c",
    "ON ": "开启 ",
    "Google drive link ": "谷歌驱动链接",
    "Keyboard Shortcuts": "快捷键",
    "Left arrow/Right arrow": "左/右箭头",
    "Load": "加载",
    "No": "否",
    "number of prestiges": "声望数字",
    "Offline progress: ": "离线进度：",
    "Rilee H": "莱利 H",
    "You've been offline for ": "你离线了 ",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
}

//需处理的后缀
var cnPostfix = {
    "                   ": "",
    "                  ": "",
    "                 ": "",
    "                ": "",
    "               ": "",
    "              ": "",
    "             ": "",
    "            ": "",
    "           ": "",
    "          ": "",
    "         ": "",
    "        ": "",
    "       ": "",
    "      ": "",
    "     ": "",
    "    ": "",
    "   ": "",
    "  ": "",
    " ": " ",
    "\n": "",
    "\n\t\t\t": "\n\t\t\t",
    "\t\t\n\t\t": "\t\t\n\t\t",
    "\t\t\t\t": "\t\t\t\t",
    "\n\t\t": "\n\t\t",
    "\t": "\t",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
    "": "",
}

//需排除的，正则匹配
var cnExcludeWhole = [
    /^(\d+)$/,
    /^\s*$/, //纯空格
    /^([\d\.]+):([\d\.]+)$/,
    /^([\d\.]+):([\d\.]+):([\d\.]+)$/,
    /^([\d\.]+)\-([\d\.]+)\-([\d\.]+)$/,
    /^([\d\.]+)e(\d+)$/,
    /^([\d\.]+)$/,
    /^([\d\.]+):([\d\.]+):([\d\.]+)$/,
    /^([\d\.]+) K$/,
    /^([\d\.]+) M$/,
    /^([\d\.]+) B$/,
    /^([\d\.]+)s$/,
    /^([\d\.]+)x$/,
    /^x([\d\.]+)$/,
    /^([\d\.,]+)$/,
    /^\+([\d\.,]+)$/,
    /^\-([\d\.,]+)$/,
    /^([\d\.,]+)x$/,
    /^([\d\.,]+)\)$/,
    /^x([\d\.,]+)$/,
    /^([\d\.]+)e([\d\.,]+)$/,
    /^e([\d\.]+)e([\d\.,]+)$/,
    /^x([\d\.]+)e([\d\.,]+)$/,
    /^([\d\.]+)e([\d\.,]+)x$/,
    /^[\u4E00-\u9FA5]+$/
];
var cnExcludePostfix = [
]

//正则替换，带数字的固定格式句子
//纯数字：(\d+)
//逗号：([\d\.,]+)
//小数点：([\d\.]+)
//原样输出的字段：(.+)
//换行加空格：\n(.+)
var cnRegReplace = new Map([
    [/^([\d\.]+) hours ([\d\.]+) minutes ([\d\.]+) seconds$/, '$1 小时 $2 分钟 $3 秒'],
    [/^You are gaining (.+) elves per second$/, '你每秒获得 $1 精灵'],
    [/^number of presiges \((.+) prestiges\)$/, '声望数量（$1 声望）'],
    [/^You have (.+) points$/, '你有 $1 点数'],
    [/^Next at (.+) points$/, '下一个在 $1 点数'],
    [/^At (.+) HPS, you earned (.+) H$/, '在 $1 HPS 时，您获得 $2 H'],
    [/^(.+) Overall H boost per Glod H$/, '$1 全局 H 提升每个 黄金 H'],
    [/^(.+) Glod H$/, '$1 黄金 H'],
    [/^(.+) Glod H Nuggets$/, '$1 黄金 H 掘金'],
    [/^(.+) Glod Nuggets$/, '$1 黄金 掘金'],
    [/^(.+) Glod H Boost$/, '$1 黄金 H 提升'],
    [/^(.+) Glod H limit$/, '$1 黄金 H 上限'],
    [/^(.+) Hs left.$/, '$1 Hs 剩余.'],
    [/^Reset for (.+) Glod H$/, '重置为 $1 黄金 H'],
    [/^Reset for (.+) Glod H \(Limit: (.+)$/, '重置为 $1 黄金 H（上限：$2'],
	[/^([\d\.]+)\/sec$/, '$1\/秒'],
	[/^([\d\.,]+)\/sec$/, '$1\/秒'],
	[/^([\d\.,]+) OOMs\/sec$/, '$1 OOMs\/秒'],
	[/^([\d\.]+) OOMs\/sec$/, '$1 OOMs\/秒'],
	[/^([\d\.]+)e([\d\.,]+)\/sec$/, '$1e$2\/秒'],
    [/^requires ([\d\.]+) more research points$/, '需要$1个研究点'],
    [/^([\d\.]+)e([\d\.,]+) points$/, '$1e$2 点数'],
    [/^([\d\.]+) elves$/, '$1 精灵'],
    [/^([\d\.]+)d ([\d\.]+)h ([\d\.]+)m$/, '$1天 $2小时 $3分'],
    [/^([\d\.]+)e([\d\.,]+) elves$/, '$1e$2 精灵'],
    [/^([\d\.,]+) Nuggets$/, '$1 掘金'],
    [/^([\d\.,]+) elves$/, '$1 精灵'],
    [/^\*(.+) to electricity gain$/, '\*$1 到电力增益'],
    [/^Cost: (.+) points$/, '成本：$1 点数'],
    [/^Req: (.+) elves$/, '要求：$1 精灵'],
    [/^Req: (.+) \/ (.+) elves$/, '要求：$1 \/ $2 精灵'],
    [/^Usages: (\d+)\/$/, '用途：$1\/'],
    [/^workers: (\d+)\/$/, '工人：$1\/'],

]);